{extend name="template/base" /}
{block name="content"}
{php}
use think\Db;
{/php}
<div class="page-container">
    <form class="form form-horizontal" id="form" method="post" action="{:\\think\\Request::instance()->baseUrl()}">
        <input type="hidden" name="id" value="{$vo.id ?? ''}">
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>酒店名称：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="酒店名称" name="hotel_name" value="{$vo.hotel_name ?? ''}"  datatype="*" nullmsg="酒店名称不能为空" errormsg="酒店名称格式错误">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>酒店位置：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="酒店位置" name="hotel_location" value="{$vo.hotel_location ?? ''}"  datatype="*" nullmsg="酒店位置不能为空" errormsg="酒店位置格式错误">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <!--<div class="row cl">-->
            <!--<label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>酒店经理：</label>-->
            <!--<div class="formControls col-xs-6 col-sm-6">-->
                <!--<input type="text" class="input-text" placeholder="酒店经理" name="hotel_manager" value="{$vo.hotel_manager ?? ''}"  datatype="*" nullmsg="酒店经理不能为空" errormsg="酒店经理格式错误">-->
            <!--</div>-->
            <!--<div class="col-xs-3 col-sm-3"></div>-->
        <!--</div>-->
        <!--<div class="row cl">-->
            <!--<label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>联系电话：</label>-->
            <!--<div class="formControls col-xs-6 col-sm-6">-->
                <!--<input type="text" class="input-text" placeholder="联系电话" name="phone" value="{$vo.phone ?? ''}"  datatype="*" nullmsg="联系电话不能为空" errormsg="联系电话格式错误">-->
            <!--</div>-->
            <!--<div class="col-xs-3 col-sm-3"></div>-->
        <!--</div>-->
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">酒店经理：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="酒店经理" name="hotel_manager" value="{$vo.hotel_manager ?? ''}">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">联系电话：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text" placeholder="联系电话" name="phone" value="{$vo.phone ?? ''}">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <!--<div class="row cl">-->
            <!--<label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>开业时间：</label>-->
            <!--<div class="formControls col-xs-6 col-sm-6">-->
                <!--<input type="text" class="input-text Wdate" autocomplete="off" placeholder="开业时间" name="open_time"-->
                       <!--value="{$vo.open_time ?date('Y-m-d',$vo['open_time']): ''}" {literal}-->
                       <!--onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" {/literal}  datatype="*" nullmsg="开业时间不能为空" errormsg="开业时间格式错误">-->
            <!--</div>-->
            <!--<div class="col-xs-3 col-sm-3"></div>-->
        <!--</div>-->
        <!--<div class="row cl">-->
            <!--<label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>装修时间：</label>-->
            <!--<div class="formControls col-xs-6 col-sm-6">-->
                <!--<input type="text" class="input-text Wdate" autocomplete="off" placeholder="装修时间" name="decorate_time"-->
                       <!--value="{$vo.decorate_time ?date('Y-m-d',$vo['decorate_time']): ''}" {literal}-->
                       <!--onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" {/literal}  datatype="*" nullmsg="装修时间不能为空" errormsg="装修时间格式错误">-->
            <!--</div>-->
            <!--<div class="col-xs-3 col-sm-3"></div>-->
        <!--</div>-->
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">备注：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <textarea class="textarea" placeholder="备注" name="remark" value="{$vo.remark ?? ''}" >{$vo.remark ?? ''}</textarea>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">酒店账户：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <div class="hotel_account">
                </div>
                <button type="button" class="btn btn-primary radius" style="margin-top: 5px;margin-bottom: 2px" onclick="addAccount()">&nbsp;&nbsp;添加&nbsp;&nbsp;</button>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">酒店房型：</label>
            {php}$hotel_room_type = Db::name('hotel_room_type')->select();{/php}
            <div class="formControls col-xs-6 col-sm-6">
                <div class="hotel_type"></div>
                <button type="button" class="btn btn-primary radius" style="margin-top: 5px;margin-bottom: 2px" onclick="addType()">&nbsp;&nbsp;添加&nbsp;&nbsp;</button>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <button type="submit" class="btn btn-primary radius">&nbsp;&nbsp;提交&nbsp;&nbsp;</button>
                <button type="button" class="btn btn-default radius ml-20" onClick="layer_close();">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
            </div>
        </div>
    </form>


</div>
{/block}
{block name="script"}
<script type="text/javascript" src="__LIB__/Validform/5.3.2/Validform.min.js"></script>
<script type="text/javascript" src="__LIB__/My97DatePicker/WdatePicker.js"></script>
<script>
    var type_num = 1;
    var accoun_num = 1;
    function addType() {
        $('.hotel_type').append("<div id='add_type_"+type_num+"' class='add_type'><label><span class='c-red'>*</span>房型名称：</label><select id='room_name_"+type_num+"' name='room_name_"+type_num+"' class='input-text' style='width:270px;vertical-align: top;margin-bottom: 2px'  datatype='*' nullmsg='房型名称不能为空'><option value=''>请选择房型名称</option>{foreach $hotel_room_type as $re}<option {if ($vo['hotel_room_type_id'] == $re['id'])} selected {/if} value='{$re.id}'>{$re.room_name}</option>{/foreach}</select><br> <label><span class='c-red'>*</span>房型数量：</label><input type='text' class='input-text'  style='width:270px;vertical-align: top;margin-right: 2px'  placeholder='房型数量' id='room_num_"+type_num+"' name='room_num_"+type_num+"' value='' datatype='*' nullmsg='房型名称不能为空' ><input class='btn btn-danger radius' style='height: 24px;margin-top:3px;margin-left: 2px' title='删除' placeholder='删除' onclick='delType(add_type_"+type_num+")' type='button' value='—'><br><hr></div>");
        type_num = type_num +1
    }
    function addAccount() {
        $('.hotel_account').append("<div id='add_accoun_"+accoun_num+"' class='add_accoun'><label><span class='c-red'>*</span>账户名称：</label><input type='text' class='input-text' style='width:270px;vertical-align: top;margin-bottom: 2px'  placeholder='账户名称' id='accoun_name_"+accoun_num+"' name='accoun_name_"+accoun_num+"' value=''  datatype='*' nullmsg='账号名称不能为空'><br><label><span class='c-red'>*</span>账&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号：</label><input type='text' class='input-text'  style='width:270px;vertical-align: top;margin-bottom: 2px'  placeholder='账号' id='accoun_val_"+accoun_num+"' name='accoun_val_"+accoun_num+"' value='' datatype='*' nullmsg='账号名称不能为空'><br><label><span class='c-red'>*</span>&nbsp;开&nbsp;户&nbsp;行：</label><input type='text' class='input-text'  style='width:270px;vertical-align: top;margin-bottom: 2px'  placeholder='开户行' id='accoun_bank_"+accoun_num+"' name='accoun_bank_"+accoun_num+"' value='' datatype='*' nullmsg='开户行不能为空' ><input class='btn btn-danger radius' style='height: 24px;margin-top:3px;margin-left: 2px;' title='删除' placeholder='删除' onclick='delAccount(add_accoun_"+accoun_num+")' type='button' value='—'><br><hr></div>")
        accoun_num = accoun_num +1
    }
    function delAccount(id) {
        id.parentNode.removeChild(id);
        console.log('remove_id',id);
    }
    function delType(id) {
        id.parentNode.removeChild(id);
        console.log('remove_id',id);
    }
    $(function () {

        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });

        $("#form").Validform({
            tiptype: 2,
            ajaxPost: true,
            showAllError: true,
            callback: function (ret){
                console.log('retss',ret);
                ajax_progress(ret);
            }
        });
    })
</script>
{/block}
